package work.oujia.promotion_dict_data;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.text.StrBuilder;

import java.nio.charset.Charset;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;

public class InvitationCodeDemo {
    private static final String type = "brandstorm_2023_invitation_code";
    private static final String prefix = "24BS";

    public static void main(String[] args) {
        Set<Integer> set = new HashSet<>();
        Random random = new Random();
        while (set.size() < 3000) {
            set.add(random.nextInt(30000, 99999));
        }
        StrBuilder sb = new StrBuilder();
        for (Integer i : set) {
            String code = prefix + i;
            System.out.println(code);

            String item = String.format(Setting.sqlItem, code, code, type);
            sb.append(item);
        }
        String sql = String.format(Setting.sql, sb.toString());
        FileUtil.writeString(sql, Setting.sqlFile, Charset.defaultCharset());

    }
}
